//
//  DCTaskBaseHeaderView.m
//  JiuyaoMotorcade
//
//  Created by 大橙子 on 2018/11/29.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCTaskBaseHeaderView.h"

@implementation DCTaskBaseHeaderView

-(void)setUpBaseHeaderView
{
    self.bgView = [[UIView alloc]init];
    self.bgView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.bgView];
    
    UIImageView *carrierImage = [[UIImageView alloc]initWithImage:IMAGENAME(@"用户头像")];
    //    carrierImage.backgroundColor = [UIColor redColor];
    self.carrierImage = carrierImage;
    [self.bgView addSubview:carrierImage];
    
    self.carrierLabel = [self getLabelWithFont:17 textAlignment:NSTextAlignmentLeft];
    [self.bgView addSubview:self.carrierLabel];
    
    self.timeLabel = [self getLabelWithFont:14 textAlignment:NSTextAlignmentCenter];
    self.timeLabel.textColor = [UIColor lightGrayColor];
    [self.bgView addSubview:self.timeLabel];
    
    self.stateLabel = [self getLabelWithFont:15 textAlignment:NSTextAlignmentRight];
    [self.bgView addSubview:self.stateLabel];
}
-(void)setBaseHeaderViewLayoutSubviews {
    
    self.bgView.frame = CGRectMake(0, 10, self.width, self.height-11);
    
    self.carrierImage.frame = CGRectMake(10, 3, self.bgView.height - 6, self.bgView.height - 6);
    self.carrierImage.layer.cornerRadius = self.carrierImage.width/2;
    
    self.carrierLabel.frame = CGRectMake(self.carrierImage.right+3, 0, 70*WIDTHSCALE6, self.bgView.height);
    
    self.timeLabel.width = 150*WIDTHSCALE6;
    self.timeLabel.height = self.bgView.height;
    self.timeLabel.y = 0;
    self.timeLabel.centerX = self.centerX;
    
    self.stateLabel.frame = CGRectMake(self.width - 70*WIDTHSCALE6, 0, 70*WIDTHSCALE6-3, self.bgView.height);
}
-(UILabel *)getLabelWithFont:(NSInteger)font textAlignment:(NSTextAlignment)textAlignment
{
    UILabel *label = [[UILabel alloc]init];
    label.font = FONT(font);
    label.textAlignment = textAlignment;
    return label;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
